<#-- 
 
 crea una clase para c# para la tabla  ${table}...
 Author : Luis Molina...
 
 -->
<#-- variables used internally by the generator... -->
<#assign nameFile="ficha_${table}">
<#assign extensionFile="aspx.cs">
<#assign languageGenerated="c#">
<#assign description="c#">
<#assign targetDirectory="main_${table}">
<#assign appliesToAllTables="true">
<#-- END variables used internally by the generator... -->
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;


namespace ${project}.portal.main_${table}
{
    public partial class ficha_${table} : System.Web.UI.Page
    {
		
		private static ${table} ${table}x = new ${table}();
        
        protected void Page_Load(object sender, EventArgs e) 
        {


			if (!Page.IsPostBack)
            {
				

				if (Request["id"] != null)
				{
					cargarDatos();
				}
             
			 }
        }

		private void cargarDatos()
        {
			${table}x = ${table}.get${table}(sf.entero(Request["id"]));
		   
			<#assign count=0>
			<#list table.getFields() as field>
				 <#if (!field.getisKey())>
					 <#-- segun el tipo de campo...   -->
					 <#switch field.getTargetType()>
							  <#case "_int">
								 <#if (!field.getisForeignKey())>
									lab${field}.Text = sf.cadena(${table}x.${field});
								 <#else>												
								 </#if>
								   <#break>
							  <#case "_string">
								 lab${field}.Text = ${table}x.${field};
								 <#break>
							  <#case "_bigstring">
								 ftb${field}.Text = ${table}x.${field};
								 <#break>
							  <#case "_date">
								 lab${field}.Text = sf.cadena(${table}x.${field});
								 <#break>
							  <<#case "_boolean">
								 ck${field}.Checked = sf.Bool(${table}x.${field});
								 <#break>
							  <<#case "_image">
								if (${table}x.${field} != "")
								{
									img${field}.ImageUrl = ${table}x.${field};
									img${field}.Visible = true;
									//img${field}.AlternateText = " " + noticiax.titulo;									
								}
								 <#break>
							  <<#case "_audio">
								if (${table}x.${field} != "")
								{
									lab${field}.Text = ${table}x.${field};
									lab${field}.Visible = true;
									//img${field}.AlternateText = " " + noticiax.titulo;									
								}
								 <#break>
							  <<#case "_documento">
								if (${table}x.${field} != "")
								{
									img${field}.ImageUrl = ${table}x.${field};
									img${field}.Visible = true;
									//img${field}.AlternateText = " " + noticiax.titulo;									
								}
								 <#break>
							  <#default>
								 lab${field}.Text = ${table}x.${field};
					</#switch>  
				 </#if>
				<#assign count = count+1>
			 </#list>
		  

			<#list table.getRelations() as relation>
			  lab${relation.getChildKey()}.Text = sf.cadena(${relation.getParentTable()}.get${relation.getParentTable()}(${relation.getChildTable()}x.${relation.getParentKey()}).${relation.getParentKey()});	
			</#list>

        }		 
     
     
        
    } 
}
